<template>
    <div>
        <svg :style="{ width, height }">
            <use :xlink:href="prefix + name" :fill="color"></use>
        </svg>
    </div>
</template>

<script setup lang='ts' name='SvgIcon'>
defineProps({
    // xlink:href 属性值前缀
    prefix: {
        type: String,
        default: '#icon-'
    },
    // 图标的名字
    name: String,
    // 图标颜色
    color: {
        type: String,
        default: 'red'
    },
    width: {
        type: String,
        default: '16px'
    },
    height: {
        type: String,
        default: '16px'
    }
})
</script>

<style scoped></style>